package mediatorPattern

open class Person(
    var name: String,//姓名
    var age: Int,//年龄
    var sex: Sex,//性别
    var request: String,//择偶标准
    private val marriageAgency: MarriageAgency//婚姻中介,找对象的人只需要依赖中介就可以了
) {
    init {
        marriageAgency.register(this)
    }

    fun findPartner() {
        marriageAgency.pair(this)
    }

    override fun toString(): String {
        return "Person(name='$name', age=$age, sex=$sex, request='$request')"
    }

    enum class Sex {
        MALE, FEMALE
    }
}